home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-10-30 | 4.7 KB | 275 lines | [TEXT/CWIE] |
- { DReminder.p -- data container class for AMReminder}
-
- Unit DReminder;
- Interface
-
- Uses
- Types,
- OSUtils,
-
-
- AMSignaler;
-
- const
- idDateTime = longint ('Date');
- idMessage = longint ('Mese');
- idShowAlert = longint ('Shot');
- idShowIcon = longint ('Shon');
- idPlaySound = longint ('Plad');
- idSoundIndex = longint ('Soux');
- idDateString = longint ('Datg');
- idTimeString = longint ('Timg');
- idYearMonthDay = longint ('Yeay');
- idHourMinute = longint ('Houe');
-
- type
- {----------}
- DReminder = object (AMSignaler)
-
- {data members}
- mDateTime: LongDateRec;
- mMessage: Str255;
- mShowAlert: Boolean;
- mShowIcon: Boolean;
- mPlaySound: Boolean;
- mSoundIndex: SInt16;
-
- {methods}
- Procedure Initialize; Override;
-
- Function GetDateTime: LongDateRec;
- Procedure SetDateTime (inValue: LongDateRec);
- Function GetMessage: Str255;
- Procedure SetMessage (inValue: Str255);
- Function GetShowAlert: Boolean;
- Procedure SetShowAlert (inValue: Boolean);
- Function GetShowIcon: Boolean;
- Procedure SetShowIcon (inValue: Boolean);
- Function GetPlaySound: Boolean;
- Procedure SetPlaySound (inValue: Boolean);
- Function GetSoundIndex: SInt16;
- Procedure SetSoundIndex (inValue: SInt16);
- Function GetDateString: Str255;
- Procedure SetDateString (inValue: Str255);
- Function GetTimeString: Str255;
- Procedure SetTimeString (inValue: Str255);
- Function GetYearMonthDay: LongDateRec;
- Procedure SetYearMonthDay (inValue: LongDateRec);
- Function GetHourMinute: LongDateRec;
- Procedure SetHourMinute (inValue: LongDateRec);
- end;
-
- {----------}
- Function NewDReminder: DReminder;
-
- {----------}
- Implementation
-
- {----------}
- Function NewDReminder: DReminder;
- var
- data: DReminder;
- begin
- data := nil;
- New (data);
- if data <> nil then begin
- data.Initialize;
- end;
- NewDReminder := data;
- end;
-
- {----------}
- Procedure DReminder.Initialize;
- begin
- inherited Initialize;
-
- mDateTime.eraAlt := 0;
- GetTime (mDateTime.oldDate);
- {mMessage := 0;}
- mShowAlert := false;
- mShowIcon := false;
- mPlaySound := false;
- mSoundIndex := 1;
- end;
-
- {----------}
- Function DReminder.GetDateTime: LongDateRec;
- begin
- GetDateTime := mDateTime;
-
-
- end;
-
- Procedure DReminder.SetDateTime (
- inValue: LongDateRec);
- begin
- mDateTime := inValue;
-
-
- SignalDataChanged (idDateTime);
- end;
-
- {----------}
- Function DReminder.GetMessage: Str255;
- begin
- GetMessage := mMessage;
-
-
- end;
-
- Procedure DReminder.SetMessage (
- inValue: Str255);
- begin
- mMessage := inValue;
-
-
- SignalDataChanged (idMessage);
- end;
-
- {----------}
- Function DReminder.GetShowAlert: Boolean;
- begin
- GetShowAlert := mShowAlert;
-
-
- end;
-
- Procedure DReminder.SetShowAlert (
- inValue: Boolean);
- begin
- mShowAlert := inValue;
-
-
- SignalDataChanged (idShowAlert);
- end;
-
- {----------}
- Function DReminder.GetShowIcon: Boolean;
- begin
- GetShowIcon := mShowIcon;
-
-
- end;
-
- Procedure DReminder.SetShowIcon (
- inValue: Boolean);
- begin
- mShowIcon := inValue;
-
-
- SignalDataChanged (idShowIcon);
- end;
-
- {----------}
- Function DReminder.GetPlaySound: Boolean;
- begin
- GetPlaySound := mPlaySound;
-
-
- end;
-
- Procedure DReminder.SetPlaySound (
- inValue: Boolean);
- begin
- mPlaySound := inValue;
-
-
- SignalDataChanged (idPlaySound);
- end;
-
- {----------}
- Function DReminder.GetSoundIndex: SInt16;
- begin
- GetSoundIndex := mSoundIndex;
-
-
- end;
-
- Procedure DReminder.SetSoundIndex (
- inValue: SInt16);
- begin
- mSoundIndex := inValue;
-
-
- SignalDataChanged (idSoundIndex);
- end;
-
- {----------}
- Function DReminder.GetDateString: Str255;
- var
- longSeconds: LongDateTime;
- dateString: Str255;
- begin
-
- LongDateToSeconds (mDateTime, longSeconds);
- LongDateString (longSeconds, shortDate, dateString, nil);
-
- GetDateString := dateString;
-
- end;
-
- Procedure DReminder.SetDateString (
- inValue: Str255);
- begin
-
- SignalDataChanged (idDateString);
- end;
-
- {----------}
- Function DReminder.GetTimeString: Str255;
- var
- longSeconds: LongDateTime;
- timeString: Str255;
- begin
-
- LongDateToSeconds (mDateTime, longSeconds);
- LongTimeString (longSeconds, false, timeString, nil);
-
- GetTimeString := timeString;
-
- end;
-
- Procedure DReminder.SetTimeString (
- inValue: Str255);
- begin
-
- SignalDataChanged (idTimeString);
- end;
-
- {----------}
- Function DReminder.GetYearMonthDay: LongDateRec;
- begin
- return mDateTime;
-
- end;
-
- Procedure DReminder.SetYearMonthDay (
- inValue: LongDateRec);
- begin
- mDateTime.year := inValue.year;
- mDateTime.month := inValue.month;
- mDateTime.day := inValue.day;
- SignalDataChanged (idDateTime);
-
- SignalDataChanged (idYearMonthDay);
- end;
-
- {----------}
- Function DReminder.GetHourMinute: LongDateRec;
- begin
- return mDateTime;
-
- end;
-
- Procedure DReminder.SetHourMinute (
- inValue: LongDateRec);
- begin
- mDateTime.hour := inValue.hour;
- mDateTime.minute := inValue.minute;
- SignalDataChanged (idDateTime);
-
- SignalDataChanged (idHourMinute);
- end;
-
- end.
-